home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1994 Marc Parmet.
- * This file is part of the Macintosh port of GNU Emacs.
- *
- * GNU Emacs is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
- #include <MacHeaders>
-
- #define ONE_LINE_DOWN 16
-
- static int have_CQD;
- static CIconHandle c_icon;
- static Handle bw_icon;
- static WindowPtr w;
- static short last_current_page = -1;
- static short last_operation = -1;
-
- void
- notify_start(void)
- {
- short err;
- long response;
-
- err = Gestalt(gestaltQuickdrawVersion,&response);
- have_CQD = !err && (response >= gestalt8BitQD);
- if (have_CQD) {
- if (c_icon == 0L)
- c_icon = GetCIcon(128);
- }
- else {
- if (bw_icon == 0L)
- bw_icon = GetIcon(128);
- }
- w = GetNewWindow(131,0L,(WindowPtr)-1L);
- MoveWindow(w,
- (screenBits.bounds.right - w->portRect.right + w->portRect.left)/2,
- screenBits.bounds.bottom/3 - (w->portRect.bottom - w->portRect.top)/2,0);
- ShowWindow(w);
- }
-
- void
- notify_message(int operation,int current_page,int total_pages,unsigned char *name)
- {
- Rect r;
- GrafPtr gp;
- unsigned char s[256],t[256];
-
- if (operation == last_operation && current_page == last_current_page) return;
-
- GetPort(&gp);
- SetPort(w);
- SetRect(&r,0,0,32,32);
- OffsetRect(&r,23 - r.left,13 - r.top);
- if (have_CQD)
- PlotCIcon(&r,c_icon);
- else
- PlotIcon(&r,bw_icon);
-
- switch (operation) {
- case 0:
- // "Formating page " x ". Press cmd-. to cancel."
- GetIndString(s,128,1);
- NumToString(current_page,t); pstrcat(s,t);
- GetIndString(t,128,2); pstrcat(s,t);
- break;
- case 1:
- if (current_page == 0) {
- // "Printing..."
- GetIndString(s,128,3);
- }
- else {
- // "Printing page " x " of " y ". Press cmd-. to cancel."
- GetIndString(s,128,4);
- NumToString(current_page,t); pstrcat(s,t);
- GetIndString(t,128,5); pstrcat(s,t);
- NumToString(total_pages,t); pstrcat(s,t);
- GetIndString(t,128,2); pstrcat(s,t);
- }
- break;
- }
- TextFont(0);
- SetRect(&r,78,13,w->portRect.right - 13,w->portRect.bottom - 13);
- TextBox(s+1,s[0],&r,teJustLeft);
-
- last_current_page = current_page;
- last_operation = operation;
- SetPort(gp);
- }
-
- void
- notify_end(void)
- {
- DisposeWindow(w);
- FlushEvents(keyDownMask | autoKeyMask,0);
- }
-